%%%%% --------------------------------------------------------------------------------
%%
%%%%***************************** version information *********************************
%%
%% this is the "commons.sty" package used for configure document styles
%% rewritten by Jie Cheng<chengjie0827@gmail.com>
%% $Last-modified: 08 Jan 2015
%%
%% This program can be redistributed and/or modified under the terms
%% of the GNU Public License, version 2.
%%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sty/commons}
  [2015/01/05 v0.1 commons
  macros package]
%%%%% --------------------------------------------------------------------------------
%%
%%%%********************************Declare Options**********************************
%%
\newif\ifCOMMONS@njust \COMMONS@njustfalse
\DeclareOption{njust}{% njust thesis style
    \COMMONS@njusttrue%
}
%% end-user parameters, each option is declared by one declare option command
\DeclareOption*{% handle non-implemented options
    \PackageWarning{commons}{Unknown option '\CurrentOption'}%
}
%% terminates all options processing
\ProcessOptions\relax
%%%%% --------------------------------------------------------------------------------
%%
%%%%********************************Required Packages*********************************
%%
%% Language Setting
\RequirePackage{ifpdf,ifxetex}
%% packages and settings depend on PDF mode
\ifxetex % running xelatex in PDF mode
%%%%% --------------------------------------------------------------------------------
%%
%%%%***********************************xelatex****************************************
%%
%%% >>> System Font Environment
%%
%% If compile by "xelatex", then it support system fonts.
%% Fonts and tweaks for xelatex:
\RequirePackage{fontspec}% fontspec package.
\defaultfontfeatures{Ligatures=TeX}% use tex style to support LaTeX quoting style.
%% -- Set English fonts.
%% Roman, or Serif - typefaces are named for the features at the ends of their strokes
%% determine \rmfamily, usually for main contents
%% because of \renewcommand*{\familydefault}{\rmdefault}, it's also determine \normalfont.
%% examples: Times New Roman, Garamond, Adobe Garamond Pro
%\setmainfont[BoldFont=Garamond-Bold,ItalicFont=Garamond-Italic]{Garamond}%
%% Sans serif - typefaces without strokes (without serif) to get high readability
%% determine \sffamily, usually for signage, headings that demanding high readability
%% examples: Helvetica, Gill Sans, Futura
%\setsansfont{Gill Sans MT}%
%% Monospaced - typefaces that every glyph is the same width (opposed to variable-width fonts).
%% determine \ttfamily, usually for programming, tabulated data, etc.
%% examples: Rockwell, Andale Mono, Courier, Monaco
%\setmonofont{Rockwell}%
\else
\ifpdf % running pdfTeX in PDF mode
%%%%% --------------------------------------------------------------------------------
%%
%%%%*********************************pdflatex*****************************************
%%
%%% >>>  Input encoding and the font encoding
%%
%% Specify language.
%% Set Language you want to use: \RequirePackage[language]{babel}
%% You should place it soon after the \documentclass command, so that all the other
%% packages you load afterwards will know the language you are using.
%\RequirePackage[english]{babel}% language.
%% Specify input encoding.
\RequirePackage[utf8]{inputenc}% make sure your document is saved using the UTF-8 encoding.
%\RequirePackage[latin1]{inputenc}% latin encoding
%% Font encoding.
\RequirePackage[T1]{fontenc}
%% Font package.
\RequirePackage{mathptmx}
%% Options:
%% Need \RequirePackage[T1]{fontenc}:
%% - \RequirePackage{lmodern}, modern font.
%% - \RequirePackage{concrete}, text: Concrete, math: Concrete italic + Euler VM symbols.
%% - \RequirePackage{concmath}, text: Concrete, math: Concrete italic + Concmath symbols.
%% No need \RequirePackage[T1]{fontenc}:
%% Text: Helvetica, Math: Helvetica italic + Euler VM symbols:
%% - \RequirePackage{eulervm} + \RequirePackage[scaled]{helvet}
%% Text: Palatino, Math: Palatino italic + Euler VM symbols:
%% - \RequirePackage{palatino} or {mathpazo} + \RequirePackage{eulervm}
%% Text + Math: Times, not a good font for screen presentation:
%% - \RequirePackage{mathptmx}
%% Text: Bradhley Hand writing, Math: mathpazo symbols:
%% - \RequirePackage{mathpazo} % Mathpazo symbols + \renewcommand{\rmdefault}{ibh} % Bradhley Hand.
\fi
\fi
%%
%% >>> graphic packages
%%
\RequirePackage{graphicx}% graphics packages for including graphics
\RequirePackage[margin=10.5pt,font=small,labelfont=bf]{caption}% caption options like:[margin=10pt,font=small,labelfont=bf]
\RequirePackage[section]{placeins}% to prevent floats from being moved over section
\usepackage{subfigure}% subcaptions for subfigures
\usepackage{subfigmat}% matrices of similar subfigures, aka small mulitples
\usepackage{overpic}
\usepackage{caption}
\usepackage{mathrsfs}
\DeclareCaptionLabelSeparator{none}{ }
\captionsetup{
  labelsep=none
}
\captionsetup{belowskip=-10pt}% narrow the skip between caption and main words
\setlength\abovedisplayskip{0pt}% set display skip between equations and main words
\setlength\belowdisplayskip{0pt}
%%
%% >>> Page Layout and Line Spacing
%%
\RequirePackage{fancyhdr}% fancy headers and footers
%\RequirePackage{geometry}% page layout
%\RequirePackage{setspace}% line spacing
%%
%%% >>> Natural Sciences Citations and References
%%
%% if use bibtex citation, not need to use any packages!
%% if use natbib package, then:
%\RequirePackage{natbib}% author year citation mode
%\RequirePackage[square,comma,numbers,sort&compress]{natbib}% numeric cite mode
\RequirePackage[square,comma,super,sort&compress]{natbib}% superscripted numeric cite mode
%\bibliographystyle{apalike}% APA citation style
%\bibliographystyle{unsrtnat}% sort as referenced
%\bibliographystyle{plainnat}% sort by author name
%\bibliographystyle{GBT7714-2005NLang}% sort as CHN standard 3-type 
%\bibliographystyle{GBT7714-2005NLang_UP}
\bibliographystyle{GBT7714-2005NLang_Upp}
\setlength{\bibsep}{0.5ex}  % vertical spacing between references
%%
%%% >>> Verbatim
%%
%% Improves the verbatim environment, fixing some bugs. Moreover
%% it provides the comment environment, that lets you add multiple-line
%% comments or easily comment out big parts of the code.
%\RequirePackage{verbatim}
%\RequirePackage{fancyvrb}%
%\RequirePackage{listing}%
%%
%% >>> List Structures
%%
%\RequirePackage{enumerate}%
%%
%%% >>> Color
%%
%\RequirePackage{color}%
%\RequirePackage[usenames,dvipsnames,svgnames,table]{xcolor}%
%%
%%% >>> Tables
%%
%% ctable package imports the array, tabularx and booktabs packages
%% all commands from those packages are available as well.
%\RequirePackage{ctable}%
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{algorithm}
\usepackage{algorithmic}
%%
%% >>> Math packages
%%
\RequirePackage{amsmath,amssymb,amstext}
%%
%% >>> hyperref packages
%%
%% packages and settings depend on PDF mode
\ifxetex % running xelatex in PDF mode
  \RequirePackage[xetex]{hyperref}
\else
  \ifpdf % running pdfTeX in PDF mode
    \RequirePackage[pdftex]{hyperref}
  \fi
\fi
%% Setting Hyperlinks
\hypersetup{% set hyperlinks.
    %pdftitle={},% title
    %pdfauthor={},% author
    %pdfsubject={},% subject
    %pdfkeywords={keyword1}{key2} {key3},% list of keywords, and uncomment this line if desired
    %pdftoolbar=true,% show Acrobat’s toolbar?
    %pdfmenubar=true,% show Acrobat’s menu?
    pdffitwindow=false,% window fit to page when opened
    pdfstartview={FitH},% fits the width of the page to the window
    %pdfnewwindow=true,% links in new window
    colorlinks=true,% false: boxed links; true: colored links
    linkcolor=blue,% color of internal links
    citecolor=black,% color of links to bibliography
    filecolor=blue,% color of file links
    urlcolor=blue% color of external links
    %hidelinks% remove link color and border.
}
%% it gives LaTeX the possibility to manage links
%% within the document or to any URL when you compile in PDF.
%% Just load the package in the preamble, at the end of all the
%% other packages but prior to other settings.
%%%%% --------------------------------------------------------------------------------
%%
%%%%*****************************Configuration Command********************************
%%
%% >>> Extensions and Directories for graphics
%%
\DeclareGraphicsExtensions{.pdf,.png,.jpg}% available graphic extensions
%\graphicspath{{./Img/}}% search path for figures, no need if use scripts to compile
%%
%%% >>> Define Some Color Command:
%%
%\pagecolor{declared-color} % page background color.
%%
%%% >>> Layout and Margin
%%
%\geometry{left=3.18cm,right=3.18cm,top=2.54cm,bottom=2.54cm}% normal margins at each side.
%\geometry{left=2.54cm,right=2.54cm,top=2.54cm,bottom=2.54cm}% normal margins at each side.
%%%%% --------------------------------------------------------------------------------
%%
%%%%*****************************Configuration nomenclature***************************
%% set the nomenclature in two columns
\usepackage{multicol}
\usepackage{nomencl}
\makenomenclature
\renewcommand*\nompreamble{\begin{multicols}{2}}
\renewcommand*\nompostamble{\end{multicols}}
\def\nomname{术\NJUSTspace 语\NJUSTspace 表}
\endinput
%% End of commons.sty
%%%%% --------------------------------------------------------------------------------
